package com.zkk.dao.impl;

import com.zkk.dao.StudentDao;
import com.zkk.pojo.Student;
import com.zkk.utils.DruidUtil;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;

import java.util.List;

public class StudentDaoImpl implements StudentDao {
    private JdbcTemplate jdbcTemplate=new JdbcTemplate(DruidUtil.getDataSource());
    @Override
    public List<Student> findAll() {
        List<Student> query = jdbcTemplate.query("select * from student", new BeanPropertyRowMapper<>(Student.class));
        if(query!=null){
            return query;
        }

        return null;
    }
}
